#ifndef COMMON_TYPE_H
#define COMMON_TYPE_H

#include <string>
#include <vector>
#include <unordered_map>

struct TaskId {
    std::string id;
};

enum class AreaType {
    MANDATORY,
    RESTRICTED,
    START,
    END,
    OBSTACLE
};

enum class EvaluationType {
    SAFETY,
    STEALTH,
    ECONOMY,
    COMPLETION
};

enum class SafetySubMetric {
    TOPOGRAPHY,
    ENVIRONMENTAL_NOISE,
    TURBULENCE
};

enum class StealthSubMetric {
    CPCD,
    ACOUSTIC_STEALTH,
    SENSOR_STEALTH
};

enum class EconomySubMetric {
    NAVIGATION_DISTANCE,
    NAVIGATION_TIME,
    NAVIGATION_ENERGY
};

enum class CompletionSubMetric {
    END_POINT_COMPLETION,
    TIME_COMPLETION,
    MANDATORY_AREA_COMPLETION
};

struct SpecialArea {
    std::string area_id;
    AreaType area_type;
    std::vector<std::pair<double, double>> polygon;
};

struct TaskAreaInfo {
    TaskId task_id;
    double min_latitude;
    double max_latitude;
    double min_longitude;
    double max_longitude;
    std::vector<SpecialArea> special_areas;
};

struct TaskInfo {
    TaskId task_id;
    std::string task_name;
    std::string task_description;
    TaskAreaInfo task_area;
};

struct EvaluationMetric {
    EvaluationType type;
    SafetySubMetric safety_sub_metric;
    StealthSubMetric stealth_sub_metric;
    EconomySubMetric economy_sub_metric;
    CompletionSubMetric completion_sub_metric;
    double weight;
    double score;
    std::vector<EvaluationMetric> sub_metrics;
};

struct NavigationTable {
    TaskId task_id;
    int trajectory_num;
    std::unordered_map<std::string, std::pair<double, double>> waypoints;
    std::unordered_map<std::string, int> time_table;
    std::unordered_map<std::string, std::pair<double, double>> heading_speed;
    std::unordered_map<std::string, double> depth;
    std::unordered_map<std::string, std::vector<std::string>> sensors;
    std::unordered_map<std::string, double> evaluation_metrics;
};

#endif // COMMON_TYPE_H